﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data;
using System.Data.SqlClient;

public partial class BlogforUSER : System.Web.UI.Page
{
    SqlConnection CON;
    SqlCommand CMD;
    SqlDataAdapter DA;
    DataSet DS;
    private string strconnect;
    protected void Page_Load(object sender, EventArgs e)
    {
        strconnect = "Server = localhost;database=photofpt;trusted_connection=true";
        CON = new SqlConnection(strconnect);
        DS = new DataSet();
        if (!IsPostBack)
            BindInfoToGridView();
    }

    protected void BindInfoToGridView()
    {
        try
        {
            if (CON.State == ConnectionState.Closed)
                CON.Open();
            CMD = new SqlCommand("demoBlog", CON);
            CMD.CommandType = CommandType.StoredProcedure;
            DA = new SqlDataAdapter(CMD);
            DA.Fill(DS);
            GridView1.DataSource = DS.Tables[0];
            GridView1.DataBind();
        }
        catch (SqlException ex)
        {
            throw new Exception(ex.Message);
        }
        finally
        {
            CON.Close();
        }
    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {

    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {

    }
    protected void btnInsert_Click(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {

    }
}